<template>
	<view class="content">
		<button type="primary" @click="previewPdf(false)">本地pdf预览</button>
		<button type="primary" @click="previewPdf(true)">在线pdf预览</button>
	</view>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { http } from '@/utils/http';

const url = ref('');

onShow(() => {});

function previewPdf(isOnline: boolean) {
	if (isOnline) {
		url.value = 'http://xjrbkz.ts.cn/newspaper/2024-01-04/20/58-1820981.pdf'
	} else {
		url.value = '/static/pdf/web/compressed.tracemonkey-pldi-09.pdf'
	}
	uni.navigateTo({
		url: `/pages/demo/pdf/pdfView?url=${url.value}` //带参跳转
	});
}
</script>

<style lang="scss" scoped>
.content {
	padding: $uni-page-padding;
	button {
		width: 70vw;
		margin-top: 10vh;
	}
}
</style>
